home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#21 (Jun 87)
/
format source
/
Format.r
< prev
next >
Wrap
Text File
|
1987-05-07
|
15KB
|
886 lines
/* Format.r 3/1/87 Timothy Standing
Resources for the SCSI formatting program.*/
#include "Types.r"
/* These define's are used in the MENU resources to disable specific
menu items. */
#define AllItems 0b1111111111111111111111111111111 /* 31 flags */
#define MenuItem1 0b00001
#define MenuItem2 0b00010
#define MenuItem3 0b00100
#define MenuItem4 0b01000
#define MenuItem5 0b10000
resource 'MENU' (128, "Apple", preload,nonpurgeable) {
128, textMenuProc,
AllItems & ~MenuItem2, /* Disable item #2 */
enabled, apple,
{
"About Format",
noicon, nokey, nomark, plain;
"-",
noicon, nokey, nomark, plain
}
};
resource 'MENU' (129, "File", preload,nonpurgeable) {
129, textMenuProc,
allEnabled,
enabled, "File",
{
"Quit",
noicon, nokey, nomark, plain
}
};
resource 'MENU' (130, "Edit", preload,nonpurgeable) {
130, textMenuProc,
AllItems & ~(MenuItem1 | MenuItem2), /* Disable items #1 & #2 */
enabled, "Edit",
{
"Undo",
noicon, "Z", nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Cut",
noicon, "X", nomark, plain;
"Copy",
noicon, "C", nomark, plain;
"Paste",
noicon, "V", nomark, plain;
"Clear",
noicon, nokey, nomark, plain
}
};
resource 'MENU' (131, "SCSI", preload,nonpurgeable) {
131, textMenuProc,
allEnabled,
enabled, "SCSI",
{
"Select Address",
noicon, nokey, nomark, plain;
"Parameters",
noicon, nokey, nomark, plain;
"Enter Defects",
noicon, nokey, nomark, plain;
"Format",
noicon, nokey, nomark, plain;
"Reset",
noicon, nokey, nomark, plain
}
};
resource 'DLOG' (128,"About Format",preload,nonpurgeable) {
{106, 106, 290, 406},
dBoxProc, visible, noGoAway, 0x0, 128, ""
};
resource 'DITL' (128,preload,nonpurgeable) {
{
/* 1 */ {141,202,161,273},
button {
enabled,
"OK"
};
/* 2 */ {15,27,41,274},
staticText {
enabled,
"A formatting program for MacTutor™"
};
/* 3 */ {46,97,69,204}, /* Author Item */
staticText {
enabled,
"by Tim Standing"
};
/* 4 */ {81,46,101,260},
staticText {
enabled,
"For help with this program see"
};
/* 5 */ {101,46,119,260},
staticText {
disabled,
"the June '87 issue of MacTutor™"
};
/* 6 */ {141,31,156,172},
staticText {
enabled,
"© 1987 Tim Standing"
}
}
};
resource 'DLOG' (129,"Select Address",preload,nonpurgeable) {
{54,99,295,391},
dBoxProc, visible, noGoAway, 0x0, 129, ""
};
resource 'DITL' (129,preload,nonpurgeable) {
{
/* 1 */ {195,75,215,135},
button {
enabled,
"Select"
};
/* 2 */ {195,160,215,220},
button {
enabled,
"Cancel"
};
/* 3 */ {55,75,75,115},
RadioButton {
enabled,
"#0"
};
/* 4 */ {85,75,105,115},
RadioButton {
enabled,
"#1"
};
/* 5 */ {115,75,135,115},
RadioButton {
enabled,
"#2"
};
/* 6 */ {145,75,165,115},
RadioButton {
enabled,
"#3"
};
/* 7 */ {55,175,75,215},
RadioButton {
enabled,
"#4"
};
/* 8 */ {85,175,105,215},
RadioButton {
enabled,
"#5"
};
/* 9 */ {115,175,135,215},
RadioButton {
enabled,
"#6"
};
/* 10 */ {145,175,160,215},
RadioButton {
disabled,
"#7"
};
/* 11 */ {160,175,175,285},
staticText {
disabled,
"(Mac's Address)"
};
/* 12 */ {12,35,30,258},
staticText {
disabled,
"Please select the SCSI address of"
};
/* 13 */ {27,35,47,263},
staticText {
disabled,
"the hard disk you wish to format:"
}
}
};
resource 'DLOG' (130,"Enter Parameters",preload,nonpurgeable) {
{33,43,330,469},
dBoxProc, visible, noGoAway, 0x0, 130, ""
};
resource 'DITL' (130,preload,nonpurgeable) {
{
/* 1 */ {260,345,280,405},
button {
enabled,
"OK"
};
/* 2 */ {230,345,250,405},
button {
enabled,
"Cancel"
};
/* 3 */ {73,115,93,158},
RadioButton {
enabled,
"1:1"
};
/* 4 */ {73,175,93,219},
RadioButton {
enabled,
"2:1"
};
/* 5 */ {73,235,93,278},
RadioButton {
enabled,
"3:1"
};
/* 6 */ {73,295,93,338},
RadioButton {
enabled,
"4:1"
};
/* 7 */ {103,135,123,402},
RadioButton {
enabled,
"3.0 mSec (ST506-Nonbuffered Seeks)"
};
/* 8 */ {123,135,143,375},
RadioButton {
enabled,
"28 uSec (ST412-Buffered Seeks)"
};
/* 9 */ {143,135,163,415},
RadioButton {
enabled,
"12 uSec (Pseudo ST412-Buffered Seeks)"
};
/* 10 */ {173,170,188,222},
EditText {
disabled,
"0"
};
/* 11 */ {203,170,218,222},
EditText {
disabled,
"0"
};
/* 12 */ {233,245,248,297},
EditText {
disabled,
"0"
};
/* 13 */ {263,245,278,297},
EditText {
disabled,
"0"
};
/* 14 */ {12,44,27,374},
StaticText {
disabled,
"Please enter the parameters for the disk that"
};
/* 15 */ {27,44,43,390},
StaticText {
disabled,
"you wish to format. Enter a zero for each unused"
};
/* 16 */ {43,43,58,303},
StaticText {
disabled,
"field. All numbers are decimal."
};
/* 17 */ {73,15,88,107},
StaticText {
disabled,
"Interleave:"
};
/* 18 */ {103,15,118,130},
StaticText {
disabled,
"Step Pulse Rate:"
};
/* 19 */ {173,15,188,144},
StaticText {
disabled,
"Number of Heads:"
};
/* 20 */ {203,15,218,162},
StaticText {
disabled,
"Number of Cylinders:"
};
/* 21 */ {233,15,248,239},
StaticText {
disabled,
"Reduced Write Current Cylinder:"
};
/* 22 */ {263,15,278,240},
StaticText {
disabled,
"Write Precompensation Cylinder:"
}
}
};
resource 'DLOG' (131,"Enter Defects",preload,nonpurgeable) {
{31,16,331,496},
dBoxProc, visible, noGoAway, 0x0, 131, ""
};
resource 'DITL' (131,preload,nonpurgeable) {
{
/* 1 */ {10,400,30,460},
button {
enabled,
"OK"
};
/* 2 */ {40,400,60,460},
button {
enabled,
"More"
};
/* 3 */ {70,400,90,460},
button {
enabled,
"Cancel"
};
/* 4 */ {120,50,135,85},
EditText {
enabled,
"0"
};
/* 5 */ {120,115,135,140},
EditText {
enabled,
"0"
};
/* 6 */ {120,160,135,210},
EditText {
enabled,
"0"
};
/* 7 */ {150,50,165,85},
EditText {
enabled,
"0"
};
/* 8 */ {150,115,165,140},
EditText {
enabled,
"0"
};
/* 9 */ {150,160,165,210},
EditText {
enabled,
"0"
};
/* 10 */ {180,50,195,85},
EditText {
enabled,
"0"
};
/* 11 */ {180,115,195,140},
EditText {
enabled,
"0"
};
/* 12 */ {180,160,195,210},
EditText {
enabled,
"0"
};
/* 13 */ {210,50,225,85},
EditText {
enabled,
"0"
};
/* 14 */ {210,115,225,140},
EditText {
enabled,
"0"
};
/* 15 */ {210,160,225,210},
EditText {
enabled,
"0"
};
/* 16 */ {240,50,255,85},
EditText {
enabled,
"0"
};
/* 17 */ {240,115,255,140},
EditText {
enabled,
"0"
};
/* 18 */ {240,160,255,210},
EditText {
enabled,
"0"
};
/* 19 */ {270,50,285,85},
EditText {
enabled,
"0"
};
/* 20 */ {270,115,285,140},
EditText {
enabled,
"0"
};
/* 21 */ {270,160,285,210},
EditText {
enabled,
"0"
};
/* 22 */ {120,290,135,325},
EditText {
enabled,
"0"
};
/* 23 */ {120,355,135,380},
EditText {
enabled,
"0"
};
/* 24 */ {120,400,135,450},
EditText {
enabled,
"0"
};
/* 25 */ {150,290,165,325},
EditText {
enabled,
"0"
};
/* 26 */ {150,355,165,380},
EditText {
enabled,
"0"
};
/* 27 */ {150,400,165,450},
EditText {
enabled,
"0"
};
/* 28 */ {180,290,195,325},
EditText {
enabled,
"0"
};
/* 29 */ {180,355,195,380},
EditText {
enabled,
"0"
};
/* 30 */ {180,400,195,450},
EditText {
enabled,
"0"
};
/* 31 */ {210,290,225,325},
EditText {
enabled,
"0"
};
/* 32 */ {210,355,225,380},
EditText {
enabled,
"0"
};
/* 33 */ {210,400,225,450},
EditText {
enabled,
"0"
};
/* 34 */ {240,290,255,325},
EditText {
enabled,
"0"
};
/* 35 */ {240,355,255,380},
EditText {
enabled,
"0"
};
/* 36 */ {240,400,255,450},
EditText {
enabled,
"0"
};
/* 37 */ {270,290,285,325},
EditText {
enabled,
"0"
};
/* 38 */ {270,355,285,380},
EditText {
enabled,
"0"
};
/* 39 */ {270,400,285,450},
EditText {
enabled,
"0"
};
/* 40 */ {10,15,25,375},
StaticText {
disabled,
"Please enter the list of defects that came with your"
};
/* 41 */ {25,15,40,375},
StaticText {
disabled,
"disk drive. Enter the Head #, Cylinder #, and Bytes"
};
/* 42 */ {40,15,55,375},
StaticText {
disabled,
"From Index (BFI) value for each defect. Enter"
};
/* 43 */ {55,15,70,370},
StaticText {
disabled,
"defects in order of increasing cylinder #. If you"
};
/* 44 */ {70,15,85,370},
StaticText {
disabled,
"have more than 12 defects, click on the More Button."
};
/* 45 */ {120,10,135,45},
StaticText {
disabled,
"#1:"
};
/* 46 */ {150,10,165,45},
StaticText {
disabled,
"#2:"
};
/* 47 */ {180,10,195,45},
StaticText {
disabled,
"#3:"
};
/* 48 */ {210,10,225,45},
StaticText {
disabled,
"#4:"
};
/* 49 */ {240,10,255,45},
StaticText {
disabled,
"#5:"
};
/* 50 */ {270,10,285,45},
StaticText {
disabled,
"#6:"
};
/* 51 */ {120,250,135,285},
StaticText {
disabled,
"#7:"
};
/* 52 */ {150,250,165,285},
StaticText {
disabled,
"#8:"
};
/* 53 */ {180,250,195,285},
StaticText {
disabled,
"#9:"
};
/* 54 */ {210,250,225,285},
StaticText {
disabled,
"#10:"
};
/* 55 */ {240,250,255,285},
StaticText {
disabled,
"#11:"
};
/* 56 */ {270,250,285,285},
StaticText {
disabled,
"#12:"
};
/* 57 */ {95,30,110,100},
StaticText {
disabled,
"Cylinder:"
};
/* 58 */ {95,110,110,155},
StaticText {
disabled,
"Head:"
};
/* 59 */ {95,165,110,200},
StaticText {
disabled,
"BFI:"
};
/* 60 */ {95,270,110,340},
StaticText {
disabled,
"Cylinder:"
};
/* 61 */ {95,350,110,395},
StaticText {
disabled,
"Head:"
};
/* 62 */ {95,410,110,445},
StaticText {
disabled,
"BFI:"
}
}
};
resource 'ALRT' (132,"Format Alert",preload,nonpurgeable) {
{100,100,250,400},
132,
{
Cancel, visible,2;
Cancel,visible,2;
Cancel,visible,2;
Cancel,Visible,2
}
};
resource 'DITL' (132,preload,nonpurgeable) {
{
/* 1 */ {115,75,135,135},
button {
enabled,
"OK"
};
/* 2 */ {115,165,135,225},
button {
enabled,
"Cancel"
};
/* 3 */ {30,80,45,290},
StaticText {
disabled,
"Do you really want to format"
};
/* 4 */ {45,80,60,290},
StaticText {
disabled,
"disk drive #^0? It will erase"
};
/* 5 */ {60,80,75,290},
Statictext {
disabled,
"all the files on this volume."
}
}
};
resource 'ALRT' (133,preload,nonpurgeable) {
{50, 40, 300, 460},
133,
{ /* array: 4 elements */
/* [1] */
OK, visible, sound1;
/* [2] */
OK, visible, sound1;
/* [3] */
OK, visible, sound1;
/* [4] */
OK, visible, sound1
}
};
resource 'DITL' (133,preload,nonpurgeable) {
{ /* array DITLarray: 8 elements */
/* [1] */
{213, 180, 233, 240},
Button {
enabled,
"OK"
};
/* [2] */
{19, 92, 34, 267},
StaticText {
enabled,
"A SCSI error has occurred!"
};
/* [3] */
{70, 15, 85, 251},
StaticText {
disabled,
"SCSI command or trap that failed:"
};
/* [4] */
{85, 35, 99, 290},
StaticText {
disabled,
"^0"
};
/* [5] */
{115, 15, 130, 125},
StaticText {
disabled,
"Type of error:"
};
/* [6] */
{130, 35, 145, 290},
StaticText {
disabled,
"^1"
};
/* [7] */
{160, 15, 175, 200},
StaticText {
disabled,
"Most probable cause:"
};
/* [8] */
{175, 35, 190, 405},
StaticText {
disabled,
"^2"
}
}
};
resource 'STR ' ($A000,preload,nonpurgeable) {
"_SCSIReset."
};
resource 'STR ' ($A100,preload,nonpurgeable) {
"_SCSIGet."
};
resource 'STR ' ($A200,preload,nonpurgeable) {
"_SCSISelect."
};
resource 'STR ' ($A300,preload,nonpurgeable) {
"_SCSICommand."
};
resource 'STR ' ($A400,preload,nonpurgeable) {
"_SCSIComplete."
};
resource 'STR ' ($A600,preload,nonpurgeable) {
"_SCSIWrite."
};
resource 'STR ' ($000,preload,nonpurgeable) {
"Test Unit Ready."
};
resource 'STR ' ($400,preload,nonpurgeable) {
"Format Unit."
};
resource 'STR ' ($1500,preload,nonpurgeable) {
"Mode Select."
};
resource 'STR ' ($1003,preload,nonpurgeable) {
"Write Fault."
};
resource 'STR ' ($1004,preload,nonpurgeable) {
"Drive not ready."
};
resource 'STR ' ($1020,preload,nonpurgeable) {
"Command not implemented."
};
resource 'STR ' ($1024,preload,nonpurgeable) {
"Bad parameter passed to controller."
};
resource 'STR ' ($AA02,preload,nonpurgeable) {
"SCSI communication error."
};
resource 'STR ' ($AA04,preload,nonpurgeable) {
"Bad pseudo program."
};
resource 'STR ' ($AA05,preload,nonpurgeable) {
"SCSI timing error."
};
resource 'STR ' ($2003,preload,nonpurgeable) {
"Drive detects failure during power on diagnostic."
};
resource 'STR ' ($2004,preload,nonpurgeable) {
"Drive not up to speed or hardware problem."
};
resource 'STR ' ($2020,preload,nonpurgeable) {
"Controller does not support this command."
};
resource 'STR ' ($2024,preload,nonpurgeable) {
"Defect in cylinder 0 or bad defect parameters."
};
resource 'STR ' ($BA02,preload,nonpurgeable) {
"Wrong address or no termination."
};
resource 'STR ' ($BA04,preload,nonpurgeable) {
"Programmer error; my fault."
};
resource 'STR ' ($BA05,preload,nonpurgeable) {
"Program uses incorrect delay value for your controller."
};
resource 'ALRT' (134,preload,nonpurgeable) {
{100, 100, 270, 400},
134,
{ /* array: 4 elements */
/* [1] */
OK, visible, sound1;
/* [2] */
OK, visible, sound1;
/* [3] */
OK, visible, sound1;
/* [4] */
OK, visible, sound1
}
};
resource 'DITL' (134,preload,nonpurgeable) {
{ /* array DITLarray: 4 elements */
/* [1] */
{129, 120, 149, 180},
Button {
enabled,
"OK"
};
/* [2] */
{20, 90, 35, 252},
StaticText {
enabled,
"No more defects can be"
};
/* [3] */
{40, 90, 55, 263},
StaticText {
disabled,
"added to the defect list."
};
/* [4] */
{60, 90, 75, 263},
StaticText {
disabled,
"The buffer is full. The"
};
/* [5] */
{80, 90, 95, 275},
StaticText {
disabled,
"first 60 defects were used."
}
}
};
resource 'DLOG' (135,preload,nonpurgeable) {
{131, 131, 231, 381},
dBoxProc,
visible,
noGoAway,
0x0,
135,
""
};
resource 'DITL' (135,preload,nonpurgeable) {
{ /* array DITLarray: 3 elements */
/* [1] */
{15, 20, 30, 230},
StaticText {
enabled,
"Now formatting SCSI disk #^0."
};
/* [2] */
{35, 20, 50, 224},
StaticText {
disabled,
"This will take between three"
};
/* [3] */
{55, 20, 70, 166},
StaticText {
disabled,
"and fifteen minutes."
}
}
};